{extend name="base/index"/}

{block name="page_location"}
<!-- BEGIN PAGE TITLE & BREADCRUMB-->
<h3 class="page-title">历史订单管理 <small> 历史订单列表</small></h3>
<ul class="breadcrumb">
    <li><i class="icon-home"></i><a href="{:url('index/index')}">管理首页</a><i class="icon-angle-right"></i></li>
    <li><a href="javascript:;">所有历史订单</a></li>
</ul>
<!-- END PAGE TITLE & BREADCRUMB-->
{/block}
{block name="body"}
<div class="row-fluid" id="order_page">
    <div class="span12">
        <div class="portlet box red">
            <div class="portlet-title">
                <div class="caption"><i class="icon-cogs"></i>所有历史订单列表</div>
                <div class="tools"></div>
            </div>
            <div class="portlet-body">
		    	<form action="{:url('order/history')}" method="get" class="form-horizontal">
					<div class="control-group">
						<label class="control-label" style="width: auto;">选择状态：</label>
						<div class="controls" style="margin-left: auto;max-width:none;">
							<select class="m-wrap small" tabindex="1" name="status">
								<option value="">所有</option>
								<option value="1" {eq name="status" value="1"}selected="selected"{/eq}>已下单</option>
								<option value="2" {eq name="status" value="2"}selected="selected"{/eq}>已支付</option>
								<option value="3" {eq name="status" value="3"}selected="selected"{/eq}>已发货</option>
								<option value="4" {eq name="status" value="4"}selected="selected"{/eq}>已收货</option>
							</select>
							<input type="text" name="kw" placeholder="搜索会员名、订单号、收货人、电话" class="m-wrap" value="{$kw}">
							<input type="submit" value="搜索" class="btn blue"  />
							<a href="javascript:;" class="btn red" id="clear_all_btn">清空所有历史订单</a>
						</div>
					</div>
		    </form>        
                <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>订单编号</th>
                            <th>会员名称</th>
                            <th>订单运费</th>
                            <th>订单总金额</th>
                            <th>订单状态</th>
                            <th>更新时间</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {volist name='list' id="data"}
                        <tr>
                            <td>{$data.oid}</td>
                            <td>{$data.uname}</td>
                            <td>{$data.freight} 元</td>
                            <td>{$data.amount} 元</td>
                            <td>
                            	{switch name="data.status"}
                            		{case value="1"}已下单,待支付{/case}
                            		{case value="2"}已支付,待发货{/case}
                            		{case value="3"}已发货,待收货{/case}
                            		{case value="4"}已收货{/case}
                            		{case value="5"}申请退货{/case}
                            		{case value="6"}已收退货{/case}
                            		{case value="7"}确认退款{/case}
                            		{case value="8"}申请换货{/case}
                            		{case value="9"}收到换货{/case}
                            	{/switch}
                            </td>
                            <td title="{$data.posttime|date="Y-m-d H:i:s",###}">{$data.posttime|date="Y-m-d H:i:s",###}</td>
                            <td>
                            	<a href="javascript:;" class="btn red mini more_btn" attr-id="{$data.id}">订单详情 <i class="icon-angle-down"></i></a>
                            	<a href="javascript:;" class="btn red mini delete_btn" attr-id="{$data.id}" attr-model="goods_order_history">订单删除 </a>
                            </td>
                        </tr>
                        <tr id="goods_{$data.id}" class="goods_more" style="display: none;">
                        	<td colspan="8">
								<div class="portlet box red">
									<div class="portlet-title">
										<div class="caption"><i class="icon-shopping-cart"></i>订单：{$data.oid} 产品列表</div>
									</div>
									<div class="portlet-body">
		                        		<table border="0" cellspacing="0" cellpadding="0" style="width: 100%;">
		                        			<tr>
		                        				<th>产品图片</th>
		                        				<th>产品名称</th>
		                        				<th>产品数量</th>
		                        				<th>产品单价</th>
		                        				<th>产品运费</th>
		                        				<th>产品总价</th>
		                        			</tr>
		                        			{volist name="data.glist" id="g"}
		                        			<tr>
		                        				<td><img src="{$g.picurl}" width="50" height="50" alt="" /></td>
		                        				<td>{$g.gname}</td>
		                        				<td>{$g.num} 件</td>
		                        				<td>{$g.salesprice} 元</td>
		                        				<td>{$g.freight} 元</td>
		                        				<td>{$g.amount} 元</td>
		                        			</tr>
		                        			{/volist}
		                        		</table>
									</div>
								</div>
								{egt name="data.status" value="3"}
								<div class="portlet box red">
									<div class="portlet-title">
										<div class="caption"><i class="icon-truck"></i>订单：{$data.oid} 物流信息</div>
									</div>
									<div class="portlet-body">
		                        		<table border="0" cellspacing="0" cellpadding="0" style="width:500px;">
		                        			<tr>
		                        				<th style="width: 20%;">物流公司：</th>
		                        				<td style="width: 30%;">{$data.express_name}</td>
		                        				<th style="width: 20%;">物流单号：</th>
		                        				<td style="width: 30%;">{$data.express_id}</td>
		                        			</tr>
		                        		</table>
									</div>
								</div>
								{/egt}
                        	</td>
                        </tr>
                        {/volist}
                    </tbody>
                </table>
                <div class="pagination pagination-small txtcenter">
                {$pagelist}
                </div>
            </div>
        </div>
    </div>
</div>
<!-- END PAGE CONTENT-->
{/block}
{block name="modal_dig"}
<!-- Modal -->
<div class="modal fade" id="new_box" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"></button>
        <h4 class="modal-title dig_title" id="myModalLabel">编辑订单</h4>
      </div>
      <div class="modal-body">
            <form action="#" class="form-horizontal" id="edit_order_frm">
            	<input type="hidden" name="id" value="" />
                <div class="control-group">
                    <label class="control-label">订单号：</label>
                    <div class="controls">
                        <input type="text" name="name" class="m-wrap medium" value="" disabled="disabled" readonly="readonly">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">是否常用：</label>
                    <div class="controls">
                        <label class="radio"><span class=""><input type="radio" name="common" value="0"></span>是</label>
                        <label class="radio"><span class=""><input type="radio" name="common" value="1" checked=""></span>否</label>   
                    </div>
                </div>           
            </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        <button type="button" class="btn red" id="save_express_post_btn">提交</button>
      </div>
    </div>
  </div>
</div>
{/block}